package com.hopu.dao.imp;

import com.hopu.dao.UserDao;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;


@Repository("userDao")
public class UserDaoImp implements UserDao {


    @Autowired
    SqlSessionTemplate sqlSessionTemplate;

    @Override
    public List<?> findForList(String s, Map map1) throws Exception{
        return sqlSessionTemplate.selectList(s,map1);
    }

    @Override
    public int usersave(String s, Map map) throws Exception{
        return sqlSessionTemplate.insert(s,map);
    }

    @Override
    public int userupdate(String s, Map map1)throws Exception {
        return sqlSessionTemplate.update(s,map1);
    }

    @Override
    public int userdel(String s, Map map1) throws Exception{
        return sqlSessionTemplate.delete(s,map1);
    }

    @Override
    public Map usercount(String str, Map map) throws Exception {
        return sqlSessionTemplate.selectOne(str,map);
    }


    @Override
    public boolean login(String str, Map map) throws Exception {
        return sqlSessionTemplate.selectOne(str,map);
    }
	
	
	  //左侧列表
    @Override
    public List<Menu> menuquery(String str) throws Exception {
        return sqlSessionTemplate.selectList(str);
    }
}
